<style lang="less">
    .card_style {
        height: 100%;
        width: 100%;
        overflow: hidden;
        .ivu-card-body {
            padding: 0px;
        }
    }
    .page_style {
        margin-top: 10px;
        text-align: right;
    }
    .bench_search {
        margin-bottom: 10px;
    }
    .nopadding .ivu-table-cell {
        padding: 0px 0px;
    }
    .item1{
        height: 42px;
        line-height: 40px;
    }
</style>

<template>
    <Card class="card_style" :bordered="false" :dis-hover="true">
        <Row class="bench_search">
            <Button type="primary" @click="exportData"><Icon type="ios-download-outline"></Icon> 导出结果</Button>
        </Row>
        <Table border :columns="columns1" :data="datalist1" ref="table1"></Table>
        <Page :total="totalnum" :current="currentPageNo" :page-size="currentPageSize" @on-change="change" class="page_style"/>
    </Card>
</template>
<script>
import { getstreelist, date2str } from '@/api/stree'

export default {
  data () {
    return {
      params: {},
      totalnum: 0,
      currentPageNo: 1,
      currentPageSize: 10,
      columns1: [
        { title: '序号', type: 'index', width: 70, align: 'center' },
        { title: '审批地区', key: 'notice_company', width: 170, align: 'center' },
        { title: '姓名', key: 'name', width: 180, align: 'center' },
        { title: '性别', key: 'sex', width: 180, align: 'center' },
        { title: '身份证号码', key: 'cardno', width: 180, align: 'center' },
        { title: '发放银行账户', key: 'bank_cardno', width: 180, align: 'center' },
        { title: '残疾类别', key: 'disabledperson', width: 180, align: 'center' },
        { title: '低保家庭残疾等级', key: 'disablity_level', width: 180, align: 'center' },
        { title: '低保边缘家庭残疾等级', key: 'dbbygrade', width: 180, align: 'center' },
        { title: '末次领取时间', key: 'create_time', width: 180, align: 'center' },
        { title: '领取金额', key: 'shbt', width: 180, align: 'center' }
      ],
      datalist1: []
    }
  },
  computed: {
    companyCode () {
      return this.$store.state.user.severUserInfo.company_code
    }
  },
  methods: {
    // 计算表达式的值
    evil (fn) {
      var Fn = Function
      return new Fn('return ' + fn)()
    },
    // 查询订单列表接口
    init () {
      this.params = {
        pageNo: this.currentPageNo,
        pageSize: this.currentPageSize,
        state: '6',
        title: '申请办理困难残疾人生活补贴',
        db: '1'
      }
      getstreelist(this.params).then(res => {
        if (res.data.errcode === 0) {
          this.datalist1 = res.data.data.results
          this.totalnum = res.data.data.totalRecord
        } else {
          this.$Notice.error({
            title: '获取补贴列表失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    // 导出名单
    exportData () {
      if (this.datalist1.length === 0) {
        this.$Notice.warning({ title: '导出失败', desc: '无统计数据' })
        return
      }
      let today = new Date()
      this.$refs.table1.exportCsv({
        filename: '社区受理统计' + date2str(today),
        original: false
      })
    },
    change (pageNo) {
      this.currentPageNo = pageNo
      this.init()
    }
  },
  mounted () {
    this.init()
  }
}
</script>
